package edu.rjxy.xjdx.emps.service;

import edu.rjxy.xjdx.emps.common.domain.Employee;
import edu.rjxy.xjdx.emps.common.utils.PageInfo;
import edu.rjxy.xjdx.emps.dao.EmployeeDao;
import edu.rjxy.xjdx.emps.dao.EmployeeDaoImpl;

import java.util.List;

public class EmployeeServiceImpl implements EmployeeService {
    EmployeeDao dao = new EmployeeDaoImpl();
    public List<Employee> findAll() {
        return dao.selectAllEmployee();
    }

    @Override
    public PageInfo<Employee> findEmpByPage(int pageNo, int pageSize) {
        return dao.selectEmpByPage(pageNo,pageSize);
    }

    @Override
    public void removeEmployeeById(int id) {
         dao.deleteEmployeeById(id);
    }

    @Override
    public int addEmployee(Employee employee) {
        return dao.insertEmployee(employee);
    }

    @Override
    public Employee findEmployeeById(int id) {
        return dao.selectEmployeeById(id);
    }

    @Override
    public int updateEmployee(Employee employee) {
        return dao.updateEmployee(employee);
    }
}
